package com.wz.datachannel.util;

import android.view.View;
import android.widget.TextView;

public class ViewUtil {
	public static void showTextNormal(TextView tv, String text) {
		if ((null == tv)) {
			return;
		}
		if (null == text) {
			text = "";
		}
		tv.setText(text);
	}

	public static int getViewVisibility(View view) {
		if (null == view) {
			return View.GONE;
		}

		return view.getVisibility();
	}

	public static boolean isViewVisibility(View view) {
		return View.VISIBLE == getViewVisibility(view);
	}

	public static void showView(View view) {
		if (null == view) {
			return;
		}

		if (View.VISIBLE != view.getVisibility()) {
			view.setVisibility(View.VISIBLE);
		}
	}

	public static void hideView(View view) {
		if (null == view) {
			return;
		}
		if (View.GONE != view.getVisibility()) {
			view.setVisibility(View.GONE);
		}

		return;
	}

	public static void inVisibleView(View view) {
		if (null == view) {
			return;
		}
		if (View.INVISIBLE != view.getVisibility()) {
			view.setVisibility(View.INVISIBLE);
		}

		return;
	}

}
